package com.team7.order.controller;


import com.team7.order.service.CourseService;
import com.team7.order.utils.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程 前端控制器
 * </p>
 *
 * @author 张煜杰
 * @since 2021-10-22
 */
@RestController
@RequestMapping("/order/course")
@Api(tags = "课程详情")
public class CourseController {
    @Autowired
    private CourseService courseService;
    @ApiOperation("通过课程id查询课程信息")
    @PostMapping("/queryAllCourse/{courseId}")
    public CommonResult queryAllCourse(@PathVariable("courseId") @RequestBody String courseId){
        CommonResult commonResult = courseService.queryAllCourse(courseId);
        return commonResult;
    }

    @ApiOperation("查询课程和讲师信息")
    @PostMapping("/queryAllCourseAndTeacherName/{id}")
    public CommonResult queryAllCourseAndTeacherName(@PathVariable("id") String id){
        CommonResult commonResult = courseService.queryAllCourseAndTeacherName(id);
        return commonResult;
    }
    @ApiOperation("查询课时信息")
    @PostMapping("/queryAllKeShi/{id}")
    public CommonResult queryAllKeShi(@PathVariable("id") String id ){
        CommonResult commonResult = courseService.queryAllKeShi(id);
        return commonResult;
    }
    //    根据课程id和会员id查询页面是否是讲师发布的
    @PostMapping("/queryAllById/{id}/{mobile}")
    public CommonResult queryAllById(@PathVariable("id") String id,@PathVariable("mobile") String mobile){
        CommonResult commonResult = courseService.queryAllById(id,mobile);
        return commonResult;
    }
    //    根据课程id和会员id判断当前账号是否为讲师
    @PostMapping("/queryMemberStatus/{id}/{mobile}")
    public CommonResult queryMemberStatus(@PathVariable("id") String id,@PathVariable("mobile") String mobile){
        CommonResult commonResult = courseService.queryMemberStatus(id,mobile);
        return commonResult;
    }
}


